﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected string strNews = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            getnewstitle();
        }

    }
    protected void binddate(DataSet ds)
    {
        string str = "SELECT subject FROM messagebox;";
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(str, con);
        SqlCommand cmd = new SqlCommand(str, con);
        cmd.ExecuteNonQuery();
        sda.Fill(ds);
        con.Close();
    }
    protected void getnewstitle()
    {
        DataSet ds = new DataSet();
        binddate(ds);
        strNews="<table>";
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                strNews = strNews+"<tr><td>";
                strNews = strNews + ds.Tables[0].Rows[i][0].ToString();
                strNews =strNews +"</tr></td>";
            }
        }
        strNews =strNews+"</table>";
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
